<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>派逊校服</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/api.css"/>
    <link rel="stylesheet" type="text/css" href="__CSS__/aui.css"/>
    <style>

        body{
            background-image: url("__IMG__/login_bg.png");
            background-color:rgba(0,0,0,0);
        }
        .aui-bar-nav .aui-iconfont{
            font-size:0.8rem;
        }

        .aui-bar-nav{
            background:transparent;
        }
        .aui-icon-tu{
            width:2.2rem;
            height:2.2rem;
            background:url(__IMG__/whiteImg.png) no-repeat 0.75rem center;
            background-size:1.1rem 1.1rem;
        }
        .logoBox{
            /*padding:2rem 2.6rem 2.5rem;*/
        }
        .logo{
            width:100%;
            height:1.3rem;
        }
        .box{
            padding:0 1.5rem;
        }
        .inputBox{
            padding:0 0.75rem;
            align-items: center;
            background:#fff;
            background: rgba(255,255,255,1);
            margin-bottom:0.75rem;
        }
        .icon{
            width:1rem;
            height:1rem;
            margin-right:0.4rem;
        }
        .qu{
            font-size:0.8rem;
            color:#AAAEB1;
            margin-right:0.75rem;
        }
        input[type="tel"],input[type="text"],input[type="password"],input[type="number"]{
            height:2.5rem;
            padding:0;

            margin:0px;
            font-size:0.8rem;
            color:#333;
            background:transparent;
        }
        input::-webkit-input-placeholder{
            font-size:0.8rem;
            color:#AAAEB1;
        }
        .code{
            font-size:0.7rem;
            color:#206CE4;
        }
        .btn{
            width:100%;
            height:2.4rem;
            line-height: 2.4rem;
            background:#EF752C;
            text-align: center;
            font-size:0.85rem;
            color:#F9F9F9;
            font-weight:500;
            margin-top:1.5rem;
            margin-bottom:0.75rem;
        }
        .ovfHiden{overflow: hidden;height: 100%;}

    </style>
</head>
<body>
<div class="logoBox">
    <img src="__IMG__/top_logo.png" alt="" class="logo">
</div>
<!--年纪、班级、姓名、性别、身份证号-->
<div class="box">
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text" name="school" class="flex-con" readonly value="{$data.school}">
    </div>
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text" name="grade" placeholder="年级" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <input type="text" name="class" placeholder="班级" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text" name="name" placeholder="学生姓名" class="flex-con">
    </div>
    <div class="inputBox flex-wrap" style="padding: 14px 0;">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input id="nan" type="radio" checked name="sex" value="男"><label for="nan">&nbsp;男</label>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input id="nv" type="radio" name="sex" value="女"><label for="nv">&nbsp;女</label>
    </div>
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text"  name="idcard" placeholder="入学年份" class="flex-con">
    </div>
    {if $data.usetype >= 2}
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        {if $data.money <= 0}
        <input type="text" name="money" placeholder="请输入金额" class="flex-con" value="">
        {else /}
        <input type="text" name="money" value="{$data.money}" readonly class="flex-con">
        {/if}
    </div>
    {/if}
    {if $data.usetype != 2}
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text" name="height" placeholder="身高(CM)" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text" name="weight" placeholder="体重(KG)" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text" name="size" placeholder="衣服尺码(CM)" class="flex-con">
    </div>
    <div style="color: cornflowerblue;">
        <a id="sizeaaa" href="JavaScript:;" style="cursor: pointer;color: cornflowerblue;">
            点击查看尺寸对照表
        </a>
    </div>
    <div class="inputBox flex-wrap">
        <input type="text" name="sw_j" placeholder="特体填写三围/肩宽" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <input type="text"  name="sw_x" placeholder="特体填写三围/胸围" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <input type="text"  name="sw_y" placeholder="特体填写三围/腰围" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <input type="text"  name="sw_t" placeholder="特体填写三围/臀围" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <input type="text"  name="sw_b" placeholder="特体填写三围/臂长" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <input type="text"  name="sw_k" placeholder="特体填写三围/裤长" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text"  name="xiguan" placeholder="穿衣习惯" class="flex-con">
    </div>
    <div class="inputBox flex-wrap">
        <img src="__IMG__/must.png" alt="" class="icon">
        <input type="text"  name="phone" placeholder="注册手机" class="flex-con">
    </div>
    {/if}
    <input type="hidden" name="type" value="{$type}" />
    <input type="hidden" name="usetype" value="{$data.usetype}" />
    <input type="hidden" name="ididid" value="{$data.id}" />
    <div class="btn" onclick="gopay()">
        {if $data.usetype == 1}提交{else /}支付{/if}
    </div>
</div>


<div class="all_div2" style="display:none;width: 100%;height: 100%;background-color: gray;position: fixed;z-index: 100;opacity: 1;top: 0;left: 0;background-color: black">
    <img src="__IMG__/size.png" style="width: 100%;height: 100%">
</div>
<div class="all_div" style="display:none;width: 100%;height: 100%;background-color: gray;position: absolute;z-index: 100;opacity: 0.5;top: 0;left: 0;background-color: black"></div>

</body>

</html>
<script src="__JS__/jquery.min.js?v=2.1.4"></script>
<script type="text/javascript">
    function gopay() {
        var id = $('input[name="ididid"]').val();
        var school = $('input[name="school"]').val();
        var grade = $('input[name="grade"]').val();
        var classclass = $('input[name="class"]').val();
        var name = $('input[name="name"]').val();
        var sex = $('input[name="sex"]:checked').val();
        var idcard = $('input[name="idcard"]').val();
        var type = $('input[name="type"]').val();
        var usetype = $('input[name="usetype"]').val();//码的类型
        var param = 'school='+school+'&grade='+grade+'&class='+classclass+'&name='+name+'&sex='+sex+'&idcard='+idcard+'&type='+type+'&id='+id;
        if(usetype >= 2){
            var money = parseFloat($('input[name="money"]').val());
            money = money.toFixed(2);
            if(money <= 0 || money == '' || money == 'NaN'){
                alert('请填写正确的金额');
                return false;
            }
            param = param +'&money='+money;
        }

        if(usetype != 2){
            var height = $('input[name="height"]').val();
            var weight = $('input[name="weight"]').val();
            var size = $('input[name="size"]').val();
            var sw_j = $('input[name="sw_j"]').val();
            var sw_x = $('input[name="sw_x"]').val();
            var sw_y = $('input[name="sw_y"]').val();
            var sw_t = $('input[name="sw_t"]').val();
            var sw_b = $('input[name="sw_b"]').val();
            var sw_k = $('input[name="sw_k"]').val();
            var xiguan = $('input[name="xiguan"]').val();
            var phone = $('input[name="phone"]').val();
            if(height=='' || weight=='' || size=='' || xiguan==''){
                alert('有未填项');
                return false;
            }
            if(checkPhone(phone) == false){
                alert('请填写正确的手机号码')
                return false;
            }
            param = param +'&height='+height;
            param = param +'&weight='+weight;
            param = param +'&size='+size;
            param = param +'&sw_j='+sw_j;
            param = param +'&sw_x='+sw_x;
            param = param +'&sw_y='+sw_y;
            param = param +'&sw_t='+sw_t;
            param = param +'&sw_b='+sw_b;
            param = param +'&sw_k='+sw_k;
            param = param +'&xiguan='+xiguan;
            param = param +'&phone='+phone;
        }
        if(school=='' || grade=='' || name=='' || idcard==''){
            alert('有未填项');
            return false;
        }else{
            var url = '{:url("Index/buy")}';
            if(usetype == 1){
                url = '{:url("Index/shouji")}';
            }else{
                if(type == 2){
                    url = '{:url("Ali/getParam")}';
                }
            }
            $.ajax({
                url:url,
                data: param, //
                type:'POST',
                dataType:'HTML',
                success: function(returndata){
                    if(usetype == 1){
                        if(returndata == 1){
                            alert('提交成功！');
                            location.reload();
                        }else{
                            alert('提交失败，请刷新重试');
                        }
                    }else{
                        if(returndata == 1){
                            alert('支付失败，请刷新重试');
                        }else if(returndata == 2){
                            alert('订单生成失败，请刷新重试');
                        }else if(returndata == 3){
                            alert('此码已不可用');
                        }else{
                            $('.all_div').css('display','block');
                            $('.all_div').html(returndata);
                        }
                    }
                },
                error:function () {
                    alert('Ajax error!');
                }
            })
        }
    }

    /**
     * 验证手机号
     * */
    function checkPhone(phone) {
        var rule = /^1[23456789]\d{9}$/;
        return rule.test(phone);
    }
    /**
     * 验证手机号
     * */
    /**
     * 验证手机号
     * */
    function checkIdcard(idCard) {
        var rule = /^2[0123456789]\d{3}$/;
        return rule.test(idCard);
    }
    $('#sizeaaa').click(function () {
        $('.all_div2').css('display','block')
        $('html,body').addClass('ovfHiden');
    })
    $('.all_div2').click(function () {
        $('.all_div2').css('display','none')
        $('html,body').removeClass('ovfHiden');
    })
</script>